package cn.opopopo.design_pattern_learn.结构型.adapter;

// 适配器类：包装旧系统，实现新接口
public class PaymentAdapter implements PaymentProcessor {
    private LegacyPaymentSystem legacySystem;

    public PaymentAdapter(LegacyPaymentSystem legacySystem) {
        this.legacySystem = legacySystem;
    }

    @Override
    public void processPayment(double amount) {
        System.out.println("适配器：准备处理金额 " + amount + " 元");
        legacySystem.makePayment(); // 调用旧系统的方法
        System.out.println("适配器：支付完成！");
    }
}